<?php

namespace app\api\model;

use think\Db;

class OrderModel extends Model
{
    public function getByNo($orderNo)
    {
        return Db::table('order')->where(['order_no' => $orderNo])->field('id,order_no,total,total_pay,pro_num,pro_title,pro_price,sku_id,sku_title,order_date,img')->select();
    }

    public function getOrderNo($user_id)
    {
        return Db::table('order')->where(['user_id' => $user_id])->field('order_no')->Distinct(true)->select();
    }


    public function add($data)
    {
        return Db::table('order')->insert($data);
    }

}